/**
 * Created by IntelliJ IDEA.
 * User: martlenn
 * Date: 24-Jan-2008
 * Time: 09:30:21
 */
package org.hkupp.db.accessors;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
/*
 * CVS information:
 *
 * $Revision$
 * $Date$
 */

/**
 * This class extends the ExperimentTableAccessor.
 *
 * @author Lennart Martens
 * @version $Id$
 */
public class Experiment extends ExperimentTableAccessor {

    public Experiment(ResultSet aRs) throws SQLException {
        super(aRs);
    }

    public static Experiment[] getExperiments(Connection aConn) throws SQLException {
        ArrayList<Experiment> experiments = new ArrayList<Experiment>();
        Statement stat = aConn.createStatement();
        ResultSet rs = stat.executeQuery("select * from experiment");
        while(rs.next()) {
            experiments.add(new Experiment(rs));
        }
        rs.close();
        stat.close();
        Experiment[] result = new Experiment[experiments.size()];
        experiments.toArray(result);
        return result;
    }

    public String toString() {
        return getTitle();
    }
}
